home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / WorldScript.p < prev    next >
Encoding:
Text File  |  1997-08-12  |  9.0 KB  |  341 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        WorldScript.p
  3.  
  4.      Contains:    WorldScript I Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1994-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT WorldScript;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __WORLDSCRIPT__}
  28. {$SETC __WORLDSCRIPT__ := 1}
  29.  
  30. {$I+}
  31. {$SETC WorldScriptIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __TRAPS__}
  38. {$I Traps.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __QUICKDRAWTEXT__}
  41. {$I QuickdrawText.p}
  42. {$ENDC}
  43.  
  44.  
  45. {$PUSH}
  46. {$ALIGN MAC68K}
  47. {$LibExport+}
  48.  
  49.  
  50. TYPE
  51.     WSIOffset                            = UInt16;
  52.     WSIByteCount                        = UInt8;
  53.     WSIByteIndex                        = UInt8;
  54. { offset from start of sub-table to row in state table }
  55.     WSIStateOffset                        = UInt16;
  56.     WSITableOffset                        = UInt32;
  57.     WSISubtableOffset                    = UInt16;
  58.     WSIGlyphcode                        = UInt16;
  59.     WSITableIdentifiers                    = UInt32;
  60.  
  61. CONST
  62.     kScriptSettingsTag            = 'info';
  63.     kMetamorphosisTag            = 'mort';
  64.     kGlyphExpansionTag            = 'g2g#';
  65.     kPropertiesTag                = 'prop';
  66.     kJustificationTag            = 'kash';
  67.     kCharToGlyphTag                = 'cmap';
  68.     kGlyphToCharTag                = 'pamc';
  69.     kFindScriptRunTag            = 'fstb';
  70.  
  71.  
  72.  
  73. {***             L O O K U P    T A B L E    T Y P E S        ***}
  74.     WSILookupSimpleArray        = 0;                            {  a simple array indexed by glyph code  }
  75.     WSILookupSegmentSingle        = 2;                            {  segment mapping to single value  }
  76.     WSILookupSegmentArray        = 4;                            {  segment mapping to lookup array  }
  77.     WSILookupSingleTable        = 6;                            {  sorted list of glyph, value pairs  }
  78.     WSILookupTrimmedArray        = 8;                            {  a simple trimmed array indexed by glyph code  }
  79.  
  80.  
  81. TYPE
  82.     WSILookupTableFormat                = INTEGER;
  83.     WSILookupValue                        = INTEGER;
  84. { An offset from the beginning of the lookup table }
  85.     WSILookupOffset                        = INTEGER;
  86. {    FORMAT SPECIFIC DEFINITIONS }
  87. {
  88.         lookupSimpleArray:
  89.         
  90.         This is a simple array which maps all glyphs in the font
  91.         to lookup values.
  92.     }
  93.     WSILookupArrayHeaderPtr = ^WSILookupArrayHeader;
  94.     WSILookupArrayHeader = RECORD
  95.         lookupValues:            ARRAY [0..0] OF WSILookupValue;            {  The array of values indexed by glyph code  }
  96.     END;
  97.  
  98. {
  99.         lookupTrimmedArray:
  100.         
  101.         This is a single trimmed array which maps a single range
  102.         of glyhs in the font to lookup values.
  103.     }
  104.     WSILookupTrimmedArrayHeaderPtr = ^WSILookupTrimmedArrayHeader;
  105.     WSILookupTrimmedArrayHeader = RECORD
  106.         firstGlyph:                WSIGlyphcode;
  107.         limitGlyph:                WSIGlyphcode;
  108.         valueArray:                ARRAY [0..0] OF WSILookupValue;
  109.     END;
  110.  
  111. { The format specific part of the subtable header }
  112.     WSILookupFormatSpecificHeaderPtr = ^WSILookupFormatSpecificHeader;
  113.     WSILookupFormatSpecificHeader = RECORD
  114.         CASE INTEGER OF
  115.         0: (
  116.             simpleArray:        WSILookupArrayHeader;                    {  rename lookupArray as simpleArray <9>  }
  117.             );
  118.         1: (
  119.             trimmedArray:        WSILookupTrimmedArrayHeader;
  120.             );
  121.     END;
  122.  
  123. { The overall subtable header }
  124.     WSILookupTableHeaderPtr = ^WSILookupTableHeader;
  125.     WSILookupTableHeader = RECORD
  126.         format:                    WSILookupTableFormat;                    {  table format  }
  127.         fsHeader:                WSILookupFormatSpecificHeader;            {  format specific header  }
  128.     END;
  129.  
  130.  
  131. {***        G L Y P H    E X P A N S I O N    ***}
  132.  
  133. CONST
  134.                                                                 {  fixed 1.0  }
  135.     kCurrentGlyphExpansionVersion = $00010000;
  136.  
  137.  
  138. TYPE
  139.     GlyphExpansionFormats                = INTEGER;
  140.  
  141. CONST
  142.     GlyphExpansionLookupFormat    = 1;
  143.     GlyphExpansionContextualFormat = 2;
  144.  
  145.  
  146. TYPE
  147.     ExpandedGlyphClusterPtr = ^ExpandedGlyphCluster;
  148.     ExpandedGlyphCluster = PACKED RECORD
  149.         numGlyphs:                WSIByteCount;
  150.         bestGlyph:                WSIByteIndex;
  151.         glyphs:                    ARRAY [0..0] OF WSIGlyphcode;
  152.     END;
  153.  
  154.     ExpandedGlyphOffsetPtr = ^ExpandedGlyphOffset;
  155.     ExpandedGlyphOffset = RECORD
  156.         glyph:                    WSIGlyphcode;
  157.         offset:                    WSIOffset;                                {  offset to ExpandedGlyphCluster  }
  158.     END;
  159.  
  160.     GlyphExpansionStateTablePtr = ^GlyphExpansionStateTable;
  161.     GlyphExpansionStateTable = RECORD
  162.         stateTableOffset:        WSISubtableOffset;
  163.         classTableOffset:        WSISubtableOffset;
  164.         actionTableOffset:        WSISubtableOffset;                        {  state, class and actions tables follow here...  }
  165.     END;
  166.  
  167.     GlyphExpansionTablePtr = ^GlyphExpansionTable;
  168.     GlyphExpansionTable = RECORD
  169.         version:                Fixed;
  170.         format:                    INTEGER;
  171.         expansionNumer:            INTEGER;
  172.         expansionDenom:            INTEGER;                                {  num/denom ratio for expansion <2>  }
  173.         CASE INTEGER OF
  174.         0: (
  175.             stateTable:            GlyphExpansionStateTable;
  176.             );
  177.         1: (
  178.             lookup:                WSILookupTableHeader;                    {  expanded glyph clusters follow here...  }
  179.             );
  180.     END;
  181.  
  182.  
  183. { Glyph-to-Character constants and types  }
  184.  
  185. CONST
  186.     kCurrentGlyphToCharVersion    = $00010100;
  187.  
  188.  
  189. TYPE
  190.     GlyphToCharLookupFormats            = INTEGER;
  191.  
  192. CONST
  193.     kGlyphToCharLookup8Format    = 1;
  194.     kGlyphToCharLookup16Format    = 2;
  195.     kGlyphToCharLookup32Format    = 3;
  196.  
  197.  
  198. TYPE
  199.     GlyphToCharFontIndex                = UInt8;
  200.     QDGlyphcode                            = UInt8;
  201.     GlyphToCharActionTablePtr = ^GlyphToCharActionTable;
  202.     GlyphToCharActionTable = RECORD
  203.         fontNameOffset:            WSISubtableOffset;                        {  offset relative to this table  }
  204.         actions:                WSILookupTableHeader;                    {  only support lookupSimpleArray format for now  }
  205.     END;
  206.  
  207.     GlyphToCharActionHeaderPtr = ^GlyphToCharActionHeader;
  208.     GlyphToCharActionHeader = RECORD
  209.         numTables:                INTEGER;                                {  0..n  }
  210.         offsets:                ARRAY [0..0] OF WSISubtableOffset;        {  offsets from start of action table header  }
  211.     END;
  212.  
  213.     GlyphToCharHeaderPtr = ^GlyphToCharHeader;
  214.     GlyphToCharHeader = RECORD
  215.         version:                Fixed;
  216.         actionOffset:            WSISubtableOffset;                        {  offset to GlyphToCharActionHeader  }
  217.         format:                    INTEGER;                                {  size of font mask  }
  218.         mappingTable:            WSILookupTableHeader;
  219.     END;
  220.  
  221.  
  222. { JUSTIFICATION TYPES
  223.     WorldScript supports justification of text using insertion. The justification
  224.     table specifies a insertion string to insert between 2 specified glyphs.
  225.     Each combination of inter-glyph boundary can be assigned a justification priority,
  226.     the higher the priority the more justification strings inserted at that position.
  227.     
  228.     The priorities for each inter-glyph boundary are specified by the justification table's
  229.     state table.
  230.     
  231.     Special handling is done for scripts which use spaces to justify, because the width of 
  232.     a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  233.     per inserting string is specified in the justification table.
  234.  
  235. }
  236.  
  237. CONST
  238.                                                                 {  1.0 not supported  }
  239.     kCurrentJustificationVersion = $0200;
  240.  
  241.     kJustificationStateTableFormat = 1;
  242.  
  243.                                                                 {  WSI's internal limitation <12>  }
  244.     kMaxJustificationStringLength = 13;
  245.  
  246.  
  247. TYPE
  248.     WSIJustificationPriority            = UInt8;
  249.  
  250. CONST
  251.     WSIJustificationSetMarkMask    = $80;
  252.  
  253.  
  254. TYPE
  255.     WSIJustificationStateEntryPtr = ^WSIJustificationStateEntry;
  256.     WSIJustificationStateEntry = PACKED RECORD
  257.         markPriority:            WSIJustificationPriority;                {  non-zero priorities means insertion  }
  258.         priority:                WSIJustificationPriority;
  259.         newState:                WSIStateOffset;
  260.     END;
  261.  
  262.     WSIJustificationClasses                = INTEGER;
  263.  
  264. CONST
  265.     wsiJustEndOfLineClass        = 0;
  266.     wsiJustEndOfRunClass        = 1;
  267.     wsiJustDeletedGlyphClass    = 2;
  268.     wsiJustUserDefinedClass        = 3;
  269.  
  270.  
  271. TYPE
  272.     WSIJustificationStates                = INTEGER;
  273.  
  274. CONST
  275.     wsiStartOfLineState            = 0;                            {  pre-defined states  }
  276.     wsiStartOfRunState            = 1;
  277.     wsiUserDefinedState            = 2;
  278.  
  279. { pre-multiplied: class# * sizeof(WSIJustificationStateEntry) }
  280.  
  281. TYPE
  282.     WSIJustificationClassOffset            = UInt8;
  283.     WSIJustificationStateTablePtr = ^WSIJustificationStateTable;
  284.     WSIJustificationStateTable = RECORD
  285.         maxPriorities:            INTEGER;
  286.         rowWidth:                INTEGER;                                {  width of a state table row in bytes  }
  287.         classTableOffset:        INTEGER;
  288.         stateTableOffset:        INTEGER;
  289.     END;
  290.  
  291. {
  292.             Last two fields of above structure - someday?
  293.             WSIJustificationClassOffset    classes[up to 64 classes supported];
  294.             WSIJustificationStateEntry    states[up to your heart's desire];
  295.         }
  296.     WSIJustificationHeaderPtr = ^WSIJustificationHeader;
  297.     WSIJustificationHeader = RECORD
  298.         version:                INTEGER;
  299.         format:                    INTEGER;
  300.         scaling:                Point;                                    {  numer/denom scaling of priority weights <7>  }
  301.         spacesPerInsertion:        INTEGER;                                {  # of $20 chars in justification insertion string <12>  }
  302.         justStringOffset:        INTEGER;                                {  offset to justification string  }
  303.         stateTable:                WSIJustificationStateTable;                {  long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows  }
  304.     END;
  305.  
  306.  
  307. { Line Layout's Property table version <11> }
  308.  
  309. CONST
  310.                                                                 {  v1.0  }
  311.     currentPropsTableVersion    = $00010000;
  312.  
  313.                                                                 {  version is octal 0100 or hex 0x40 (#64)  }
  314.     kCharToGlyphCurrentVersion    = $40;
  315.  
  316. { pass as priorityWeight to JustifyWSILayout to use script's current just setting }
  317.     kScriptsDefaultJustWeight    = -1;
  318.  
  319.  
  320. { feature selectors used in FindScriptRun and itl5 configuration tables <9> }
  321.  
  322. TYPE
  323.     WSIFeatureType                        = UInt16;
  324.     WSIFeatureSelector                    = UInt16;
  325.     WSIFeaturePtr = ^WSIFeature;
  326.     WSIFeature = RECORD
  327.         featureType:            WSIFeatureType;
  328.         featureSelector:        WSIFeatureSelector;
  329.     END;
  330.  
  331. {$ALIGN RESET}
  332. {$POP}
  333.  
  334. {$SETC UsingIncludes := WorldScriptIncludes}
  335.  
  336. {$ENDC} {__WORLDSCRIPT__}
  337.  
  338. {$IFC NOT UsingIncludes}
  339.  END.
  340. {$ENDC}
  341.